import * as React from 'react'
import {PolygonUtil} from "../../../util/PolygonUtil"
import {BaseNodeWidget} from "../base/BaseNodeWidget"

export class DiamondNodeWidget extends BaseNodeWidget {
    static defaultProps = {
        node: null,
        size : 100,
        color: '#ffc107',
        strokeWidth:'1',
    };

    constructor (props){
        super(props)
        this.state = {
            width : props.size,
            height : props.size,
        }
    }

    createShape (props) {
        const polygonProps = {
            size : props.size,
            className : "diamond",
            strokeWidth : props.strokeWidth,
            color: props.color,
            stroke: props.stroke,
            name : props.name,
        }
        return PolygonUtil.createDiamondPolygon(polygonProps)
    };
}

export var DiamondNodeWidgetFactory = React.createFactory(DiamondNodeWidget)
